10 ' ****************************************************************** 20 ' * Example EXAM4.BAS calculation of linearity error * 30 ' * swept measurement level versus level beginning with max level * 40 ' * Setup for this example: EXAM4.SAC (Actual Setup Mode!) * 50 ' ****************************************************************** 60 ' 70 UPL OUT "MMEM:LOAD:STAT 0,'C:\UPL\B10_EXAM\EXAM4.SAC'": 'load setup 80 ' 90 UPL OUT "init:cont off": ' set single sweep 100 UPL OUT "init;*wai": ' trigger and wait for termination 110 UPL OUT "trac:poin? trac1": 'ask for number of points 120 UPL IN W$: Poin=VAL(W$): ' read out of number of points 130 ' Dimensioning 140 DIM A(Poin),B(Poin),X(Poin),Ak(Poin),Bk(Poin) 150 UPL OUT "trac? trac1" 160 UPL BLOCKIN A(1): ' read out trace1 data beginning with index 1 170 UPL OUT "trac? trac2" 180 UPL BLOCKIN B(1): ' read out of trace2 data 190 UPL OUT "sour:list:volt?" 200 UPL BLOCKIN X(1): ' read out of X-values 210 ' calculation of linearity error 220 ' all measured values are nomalized to the X-values 230 ' with ideal linearity all values will be =1 240 ' the display in dBr related to 1 V shows the linearity error 250 FOR N=1 TO Poin 260 Ak(N)=(A(N)/X(N)) 270 Bk(N)=(B(N)/X(N)) 280 NEXT 290 UPL BLOCKOUT Ak(1),Poin 300 UPL OUT "trac trac1": ' write calculated values in trace1 buffer 310 UPL BLOCKOUT Bk(1),Poin 320 UPL OUT "trac trac2" 330 UPL OUT "DISP:TRAC:Y:UNIT DBR": ' select unit dBr 340 UPL OUT "DISP:TRAC:Y:TOP 1 DBR": ' scaling of Y-axis 350 UPL OUT "DISP:TRAC:Y:BOTT -1 DBR" 360 UPL OUT "DISP:TEXT 'Linearity error'": ' text in graphic 370 PRINT "After switching back to UPL graphic with F3 key, the" 380 PRINT "measured curve will be displayed. Afterwards switch back to" 390 PRINT "Automatic Control display with F3 too!" 400 END